package com.app.oral.dao

import com.app.oral.model.User
import org.apache.ibatis.annotations.Mapper

@Mapper
interface UserMapper {
    fun findByOpenid(openid: String): User?
    fun findById(id: Long): User?
    fun insert(user: User): Int
    fun updateProfile(user: User): Int
    fun updateStatus(userId: Long, status: String, activated: Boolean, activatedTime: String?): Int
    fun findPendingStudents(): List<User>
    fun findPendingTeachers(): List<User>
    fun findAllUsers(): List<User>
    fun searchByRealName(realName: String): List<User>
    fun findByStatus(status: String): List<User>
    fun updateLastLoginTime(openid: String): Int
    
    // 多班级相关查询方法
    fun findStudentsByClassId(classId: Long): List<User>
    fun findTeachersByClassId(classId: Long): List<User>
    fun findStudentsByClassIds(classIds: List<Long>): List<User>
    fun countStudentsByClassId(classId: Long): Int
    
    // 按用户类型查询方法
    fun findByUserType(userType: String): List<User>
    
    // 删除用户方法
    fun deleteById(userId: Long): Int
}